package com.pnnd.stream;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * 可以获取道inputStream和outputStream的MemorySegment
 * 获取到的inputStream和outputStream是成对的，当写入是inputStream的limit和变大
 * ----------------memorySegment----------------
 *                        offset
 * |      inputStream      |   outputStream    |
 * |_______________________|___________________|
 *
 */
public interface MemoryReaderWriter {

    /**
     * 当前Segment内存总大小
     * @return int value
     */
    int capacity();


    /**
     * 读写的中间偏移量
     * @return int value
     */
    int offset();

    /**
     * @return inputStream
     * @see SingleSegmentInputStream
     */
    InputStream getInputStream();

    /**
     * @return inputStream
     * @see SingleSegmentOutputStream
     */
    OutputStream getOutputStream();



}
